import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    counter: 0
  },
  getters: {},
  mutations: {
    jiaM(state) {
      // console.log("jiaM");
      state.counter++;
    },
    jianM(state, val) {
      state.counter -= val;
    }
  },
  actions: {
    jiaA(content) { //上下文
      // console.log("jiaA");
      content.commit('jiaM');
    },
    jianA(content, val) {
      content.commit('jianM', val);
    }
  },
  modules: {}
})
